import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ball_lion/service/config_service.dart';
import 'package:ball_lion/resources/colours.dart';
import 'package:ball_lion/resources/styles.dart';
import 'package:ball_lion/utils/widget_utils.dart';
import 'package:ball_lion/widgets/base/wqs_widget.dart';

import 'package:ball_lion/widgets/base/wqs_text.dart';

class OddsShowPage extends StatefulWidget {
  const OddsShowPage({super.key});

  @override
  State<OddsShowPage> createState() => _OddsShowPageState();
}

class _OddsShowPageState extends State<OddsShowPage> {
  ConfigService configService = Get.find<ConfigService>();
  List<String> title = ['初始', '即时'];
  //0足球  1篮球
  int type = Get.arguments;
  @override
  Widget build(BuildContext context) {
    List<Widget> widget = [];
    for (int index = 0; index < title.length; index++) {
      widget.add(type == 0
          ? QsWidget.selectCell(
              title[index], configService.zqConfig.zqList9 == index, onTap: () {
              configService.zqConfig.zqList9 = index;
              update();
              configService.update(
                  ConfigType.zqList9, configService.zqConfig.zqList9);
            })
          : QsWidget.selectCell(
              title[index], configService.lqConfig.lqList9 == index, onTap: () {
              configService.lqConfig.lqList9 = index;
              update();
              configService.update(
                  ConfigType.lqList9, configService.lqConfig.lqList9);
            }));
      if (index != title.length - 1) {
        widget.add(QsWidget.seperateLine());
      }
    }
    return Scaffold(
      appBar: Styles.appBar(title: QsText('指数显示')),
      backgroundColor: Colours.scaffoldBg,
      body: ListView(children: [
        SizedBox(height: 10),
        Styles.card(
            margin: EdgeInsets.symmetric(horizontal: 8),
            child: Column(
              children: widget,
            ))
      ]),
    );
  }
}
